//
//  HugeAmountsBuyersTableViewCell.m
//  GLGW_Shoping
//
//  Created by yang on 2018/12/5.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "HugeAmountsBuyersTableViewCell.h"

@interface HugeAmountsBuyersTableViewCell ()
@property (nonatomic,strong) GLGWLabel * companyNameLabel;
@property (nonatomic,strong) GLGWLabel * adressLabel;
@property (nonatomic,strong) GLGWLabel * mainLabel;
@property (nonatomic,strong) GLGWLabel * buyLabel;

@end

@implementation HugeAmountsBuyersTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        GLGWView * bankgroundView = [[GLGWView alloc] initWithInSuperView:self.contentView];
        bankgroundView.backgroundColor = [UIColor whiteColor];
        [bankgroundView setViewShadowWidth:3.0 theCornerRadius:3.0];
        [bankgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.right.equalTo(self.contentView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(self.contentView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(10));
            make.bottom.equalTo(self.contentView.mas_bottom).offset(-kHeightProportion_In_iPhoneTriploid(10));
        }];
        //
        self.companyNameLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(16) theColor:kColor_Rule_Black inSuperView:bankgroundView];
        self.companyNameLabel.text = @"北京泽人合物资有限公司";
        [self.companyNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(bankgroundView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(bankgroundView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(10));
        }];
        //
        self.adressLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#666666"] inSuperView:bankgroundView];
        self.adressLabel.text = @"北京·朝阳区";
        [self.adressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.companyNameLabel.mas_right).offset(kWidthProportion_In_iPhoneTriploid(10));
            make.right.equalTo(bankgroundView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(bankgroundView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(17));
        }];
        //
        NSArray * labelTitleArr = @[@"担保交易",@"即时到账"];
        for (int i=0; i<2; i++) {
            GLGWLabel * danBaoLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:kColor_Rule_Yellow inSuperView:bankgroundView];
            danBaoLabel.text = labelTitleArr[i];
            danBaoLabel.textAlignment = NSTextAlignmentCenter;
            danBaoLabel.layer.borderColor = kColor_Rule_Yellow.CGColor;
            danBaoLabel.layer.borderWidth = 1.0;
            danBaoLabel.layer.masksToBounds = YES;
            [danBaoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(bankgroundView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15)+kWidthProportion_In_iPhoneTriploid(80)*i);
                make.top.equalTo(self.companyNameLabel.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(5));
                make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(70)));
                make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(20)));
            }];
        }
        //
        self.mainLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:bankgroundView];
        self.mainLabel.numberOfLines = 0;
//        self.mainLabel.text = @"主营：普卷、低合金卷、花纹卷、三级螺纹钢、高线、普板、 低合金板、容器板、冷轧、酸洗卷、镀锌卷、H型钢、角钢、 无缝管、热轧卷、冷轧平板、汽车钢、家电钢…";
        self.mainLabel.attributedText = [GLGWLabel changeLineWithSpace:2 theInoutText:@"主营：普卷、低合金卷、花纹卷、三级螺纹钢、高线、普板、 低合金板、容器板、冷轧、酸洗卷、镀锌卷、H型钢、角钢、 无缝管、热轧卷、冷轧平板、汽车钢、家电钢…"];
        [self.mainLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(bankgroundView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.right.equalTo(bankgroundView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(self.companyNameLabel.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(35));
        }];
        //
        self.buyLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:bankgroundView];
        self.buyLabel.text = @"3次采购/每周";
        [self.buyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mainLabel);
            make.bottom.equalTo(bankgroundView.mas_bottom).offset(-kHeightProportion_In_iPhoneTriploid(15));
        }];
        //
        GLGWButton * phoneBut = [[GLGWButton alloc] initWithTitle:@"联系卖家" titleLableFont:SYSTEMFONT(12) titleLableColor:[UIColor whiteColor] theCornerRadius:3.0 backgroundColr:kColor_Rule_Yellow inSuperView:bankgroundView];
        [phoneBut mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(bankgroundView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.bottom.equalTo(bankgroundView.mas_bottom).offset(-kHeightProportion_In_iPhoneTriploid(10));
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(55)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(25)));
        }];
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
